package com.test.springcloudservice.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.test.springcloudservice.entity.UserEntity;
import com.test.springcloudservice.mapper.UserMapper;
import com.test.springcloudservice.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Resource
    UserMapper userMapper;

    @Override
    public UserEntity queryBySid(Long sid) {
        return userMapper.selectById(sid);
    }

    @Override
    public List<UserEntity> queryUserList() {
        QueryWrapper<UserEntity> queryWrapper = new QueryWrapper<>();
        return userMapper.selectList(queryWrapper);
    }

    @Override
    public Page<UserEntity> queryUserPage() {
        QueryWrapper<UserEntity> queryWrapper = new QueryWrapper<>();
        Page<UserEntity> page = new Page<>(1,2);
        return userMapper.selectPage(page, queryWrapper);
    }
}
